﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UserInfoModel : MonoBehaviour {

    public UISprite Avatar;
    public UITexture wxAvatar;
    public UILabel username;
    public UILabel coinCount;
    public UILabel Ip;
    public UILabel ID;
    
    EginMahjong mahjong = EginMahjong.Instance;
    EginUser user = EginUser.Instance;
    private void Start()
    {
        //username.text=user
       
    }
    public void LoadIndex(int index) {
        
        for (int i = 0; i < user.gameUserInfoList.Count; i++)
        {
            if (index == user.gameUserInfoList[i].SeatId)
            {
                coinCount.text = user.gameUserInfoList[i].BagCoinCount.ToString();
                Ip.text = user.gameUserInfoList[i].Ip;
                username.text = user.gameUserInfoList[i].Nickname;                
                ID.text = user.gameUserInfoList[i].Uid.ToString();
                if(user.gameUserInfoList[i].AvatarUrl != ""){
                    WXAvatarManager._instance.GetWxAvatar(user.gameUserInfoList[i].Uid,wxAvatar,user.gameUserInfoList[i].AvatarUrl);
                    wxAvatar.gameObject.SetActive(true);
                }
                else
                {
                    Avatar.spriteName = user.gameUserInfoList[i].AvatarId.ToString();
                }
                
            }
        }
         Debug.Log("玩家的seatid" + index);
        

    }
    public void desObj() {
        Destroy(this.gameObject);
    }
}
